package ace.module.oauth2.server.api.model.dto;

import io.swagger.v3.oas.annotations.media.Schema;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import jakarta.validation.constraints.*;
import jakarta.annotation.Nullable;
import java.io.Serializable;

/**
* oauth2 客户端 data transform object.
*
* @author Caspar
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Schema(title = Oauth2RegisteredClientDto.TABLE_DESC)
public class Oauth2RegisteredClientDto implements Serializable {

  public static final String TABLE_NAME = "oauth2_registered_client";
  public static final String TABLE_DESC = "oauth2 客户端";
  public static final String ID_COLUMN_NAME = "id";
  public static final String ID_TITLE = "id";
  public static final String ID_DESC = "";
  public static final String CLIENT_ID_COLUMN_NAME = "client_id";
  public static final String CLIENT_ID_TITLE = "客户端id";
  public static final String CLIENT_ID_DESC = "";
  public static final String CLIENT_ID_ISSUED_AT_COLUMN_NAME = "client_id_issued_at";
  public static final String CLIENT_ID_ISSUED_AT_TITLE = "clientId发布时间";
  public static final String CLIENT_ID_ISSUED_AT_DESC = "单位时间-秒";
  public static final String CLIENT_SECRET_COLUMN_NAME = "client_secret";
  public static final String CLIENT_SECRET_TITLE = "客户端密钥";
  public static final String CLIENT_SECRET_DESC = "";
  public static final String CLIENT_SECRET_EXPIRES_AT_COLUMN_NAME = "client_secret_expires_at";
  public static final String CLIENT_SECRET_EXPIRES_AT_TITLE = "授权code过期时间";
  public static final String CLIENT_SECRET_EXPIRES_AT_DESC = "单位时间-秒";
  public static final String CLIENT_NAME_COLUMN_NAME = "client_name";
  public static final String CLIENT_NAME_TITLE = "客户端名称";
  public static final String CLIENT_NAME_DESC = "";
  public static final String CLIENT_AUTHENTICATION_METHODS_COLUMN_NAME = "client_authentication_methods";
  public static final String CLIENT_AUTHENTICATION_METHODS_TITLE = "客户端认证方式集合";
  public static final String CLIENT_AUTHENTICATION_METHODS_DESC = " client_secret_basic-basic认证方式 client_secret_post-post认证方式 client_secret_jwt-客户端密钥jwt private_key_jwt-私有key jwt none-空";
  public static final String AUTHORIZATION_GRANT_TYPES_COLUMN_NAME = "authorization_grant_types";
  public static final String AUTHORIZATION_GRANT_TYPES_TITLE = "授权的协议集合";
  public static final String AUTHORIZATION_GRANT_TYPES_DESC = " authorization_code-授权码认证 refresh_token-刷新token client_credentials-客户端认证 password-密码认证 rest-rest访问认证 external_user-外部主动认证";
  public static final String REDIRECT_URIS_COLUMN_NAME = "redirect_uris";
  public static final String REDIRECT_URIS_TITLE = "客户端授权协议重定向链接集合";
  public static final String REDIRECT_URIS_DESC = "";
  public static final String SCOPES_COLUMN_NAME = "scopes";
  public static final String SCOPES_TITLE = "客户端scope集合 [,]分隔";
  public static final String SCOPES_DESC = "";
  public static final String CLIENT_SETTINGS_COLUMN_NAME = "client_settings";
  public static final String CLIENT_SETTINGS_TITLE = "客户端配置";
  public static final String CLIENT_SETTINGS_DESC = "";
  public static final String TOKEN_SETTINGS_COLUMN_NAME = "token_settings";
  public static final String TOKEN_SETTINGS_TITLE = "客户端token授配置";
  public static final String TOKEN_SETTINGS_DESC = "";
  public static final String DELETE_FLAG_COLUMN_NAME = "delete_flag";
  public static final String DELETE_FLAG_TITLE = "删除标志";
  public static final String DELETE_FLAG_DESC = "0-未删除";
  public static final String CREATE_TIME_COLUMN_NAME = "create_time";
  public static final String CREATE_TIME_TITLE = "创建时间";
  public static final String CREATE_TIME_DESC = "单位-毫秒";
  public static final String UPDATE_TIME_COLUMN_NAME = "update_time";
  public static final String UPDATE_TIME_TITLE = "更新时间";
  public static final String UPDATE_TIME_DESC = "单位-毫秒";
  public static final String ROW_VERSION_COLUMN_NAME = "row_version";
  public static final String ROW_VERSION_TITLE = "版本号和乐观锁";
  public static final String ROW_VERSION_DESC = "";

  @Size(max = 255)
  @Schema(title = ID_TITLE, description = ID_DESC)
  private String id;

  @Size(max = 255)
  @Schema(title = CLIENT_ID_TITLE, description = CLIENT_ID_DESC)
  private String clientId;

  @Schema(title = CLIENT_ID_ISSUED_AT_TITLE, description = CLIENT_ID_ISSUED_AT_DESC)
  private Long clientIdIssuedAt;

  @Size(max = 255)
  @Schema(title = CLIENT_SECRET_TITLE, description = CLIENT_SECRET_DESC)
  private String clientSecret;

  @Schema(title = CLIENT_SECRET_EXPIRES_AT_TITLE, description = CLIENT_SECRET_EXPIRES_AT_DESC)
  private Long clientSecretExpiresAt;

  @Size(max = 255)
  @Schema(title = CLIENT_NAME_TITLE, description = CLIENT_NAME_DESC)
  private String clientName;

  @Size(max = 255)
  @Schema(title = CLIENT_AUTHENTICATION_METHODS_TITLE, description = CLIENT_AUTHENTICATION_METHODS_DESC)
  private String clientAuthenticationMethods;

  @Size(max = 255)
  @Schema(title = AUTHORIZATION_GRANT_TYPES_TITLE, description = AUTHORIZATION_GRANT_TYPES_DESC)
  private String authorizationGrantTypes;

  @Schema(title = REDIRECT_URIS_TITLE, description = REDIRECT_URIS_DESC)
  private String redirectUris;

  @Schema(title = SCOPES_TITLE, description = SCOPES_DESC)
  private String scopes;

  @Schema(title = CLIENT_SETTINGS_TITLE, description = CLIENT_SETTINGS_DESC)
  private String clientSettings;

  @Schema(title = TOKEN_SETTINGS_TITLE, description = TOKEN_SETTINGS_DESC)
  private String tokenSettings;

  @Size(max = 255)
  @Schema(title = DELETE_FLAG_TITLE, description = DELETE_FLAG_DESC)
  private String deleteFlag;

  @Schema(title = CREATE_TIME_TITLE, description = CREATE_TIME_DESC)
  private Long createTime;

  @Schema(title = UPDATE_TIME_TITLE, description = UPDATE_TIME_DESC)
  private Long updateTime;

  @Schema(title = ROW_VERSION_TITLE, description = ROW_VERSION_DESC)
  private Long rowVersion;

}